<template>
  <div>
    <Row>
      <Col :span="16" :offset="4">
        <Form v-model="addteam" ref="addteam" :label-width="100">
          <FormItem label="成员姓名">
            <Input type="text" v-model="addteam.name" placeholder="请输入成员姓名" />
          </FormItem>
          <FormItem label="英文名">
            <Input type="text" v-model="addteam.enname" placeholder="请输入成员的英文名字或拼音" />
          </FormItem>
          <FormItem label="职位名称">
            <Input type="text" v-model="addteam.title" placeholder="请输入成员的职位名称" />
          </FormItem>
          <FormItem label="个人介绍">
            <Input type="textarea" v-model="addteam.jieshao" placeholder="请输入成员的个人介绍" />
          </FormItem>
          <FormItem label="所属团队">
            <Select v-model="addteam.type">
              <Option label="顾问" value="1"></Option>
              <Option label="专家" value="2"></Option>
            </Select>
          </FormItem>
          <FormItem>
            <Button type="primary" @click="addTeamMember">提交</Button>
          </FormItem>
        </Form>
      </Col>
    </Row>
  </div>
</template>

<script>
export default {
  layout: 'admin',
  data() {
    return {
      addteam: {
        name: '',
        enname: '',
        title: '',
        jieshao: '',
        type: '1'
      }
    }
  },
  methods: {
    addTeamMember() {
      this.$axios.post('/adminapi/addTeamMember', this.addteam).then(res => {
        if (res.data.code == 200) {
          this.$Message.success('新团队成员添加成功')
          this.$router.replace('/admin/team')
        } else {
          this.$Message.error('添加失败，稍后重试')
        }
      }).catch(err => {
        this.$Message.error('网络错误，请稍后重试')
      })
    }
  }
}
</script>